import { useEffect } from 'react';
import { useSelector, useDispatch } from 'react-redux';
import { StoreState } from '../../store';
import * as types from '../../types/api';
import { getNewMultiAction } from '../../store/actions/homepage';

export default function Homepage () {

  const newMultiList = useSelector<StoreState, types.NewMultiData[]>(state => state.homepage.newMultiList);

  const dispatch = useDispatch();

  useEffect(() => {
    const action = getNewMultiAction();
    dispatch(action as any);
  }, []);

  return (
    <div>
      主页
      {
        newMultiList.map((item) => <div key={ item.id }>{ item.name }</div>)
      }
    </div>
  );
}
